package mid

func IsArraySpecial(nums []int, queries [][]int) []bool {
	n := len(nums)
	dp := make([]int, n)
	for i := 0; i < n; i++ {
		dp[i] = 1
	}
	for i := 1; i < n; i++ {
		if (nums[i]^nums[i-1])&1 == 1 {
			dp[i] = dp[i-1] + 1
		}
	}
	res := make([]bool, len(queries))
	for i, q := range queries {
		x, y := q[0], q[1]
		res[i] = dp[y] >= y-x+1
	}
	return res
}
